<!DOCTYPE html>
<html>
<head>
    <title>region form</title>
    <#include "/header.html">
</head>
<body class="bg-white">
<div id="appMain">
    <form class="layui-form layuimini-form" action="" lay-filter="dataForm">
        <div class="layui-form-item">
            <label class="layui-form-label">会员名字</label>
            <div class="layui-input-block">
                <input type="text" name="name" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">会员类型</label>
            <div class="layui-input-block">
                <input type="radio" name="type" value="0" title="新人礼包" checked="">
                <input type="radio" name="type" value="10" title="单次卡">
                <input type="radio" name="type" value="20" title="段位卡">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">发布次次数</label>
            <div class="layui-input-block">
                <input type="text" name="publish" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">刷新置顶次数</label>
            <div class="layui-input-block">
                <input type="text" name="redoTop" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">置顶次数</label>
            <div class="layui-input-block">
                <input type="text" name="top" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">置顶时长（天）</label>
            <div class="layui-input-block">
                <input type="text" name="topTime" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">热点展示</label>
            <div class="layui-input-block">
                <input type="radio" name="hot" value="0" title="否">
                <input type="radio" name="hot" value="1" title="是">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">优先展示</label>
            <div class="layui-input-block">
                <input type="radio" name="priority" value="0" title="否">
                <input type="radio" name="priority" value="1" title="是">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">过期时间（天）</label>
            <div class="layui-input-block">
                <input type="text" name="expirationTime" lay-verify="required" lay-reqtext="请输入过期天数" placeholder="请输入过期天数" autocomplete="off" class="layui-input"/>
            </div>
        </div>
        
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="radio" name="status" value="0" title="禁用">
                <input type="radio" name="status" value="1" title="启用" checked="">
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" id="commitBtn" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    layui.use(['form', 'laydate', 'laytpl'], function () {
        var form = layui.form,
	        laytpl = layui.laytpl,
            $ = layui.$;
        var laydate = layui.laydate;

        var _parent = parent;
        $(document).ready(function () {
            if (parent.formDataId > 0) {
                $.ajax({
                    type: "POST",
                    url: serverUrl('vipjob/info/' + parent.formDataId),
                    data: {},
                    dataType: "json",
                    success: function (result) {
                        if (result.code === 0) {
                            form.val('dataForm', result.info);
                        }
                    }
                });
            }
        });
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var params = data.field;
            params['id'] = _parent.formDataId || null;
            
            var method = _parent.formDataId > 0 ? 'update' : 'save';
            submitFormData('vipjob/'+method, params, function (res) {
                
            });
            return false;
        });

    });
</script>
</body>
</html>